package testjava;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.CRC32;

public class CrcUtil {

    public static long crc32(File file) throws IOException {
        CRC32 c = new CRC32();
        FileInputStream fis = new FileInputStream(file);
        byte[] b = new byte[1024];
        int len = fis.read(b);
        while (len > 0) {
            c.update(b, 0, len);
            len = fis.read(b);
        }
        fis.close();
        return c.getValue();
    }

}
